// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gax;
extern crate gaxi;
extern crate lazy_static;
extern crate oslogin_common;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// The user profile information used for logging in to a virtual machine on
/// Google Compute Engine.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LoginProfile {
    /// Required. A unique user ID.
    pub name: std::string::String,

    /// The list of POSIX accounts associated with the user.
    pub posix_accounts: std::vec::Vec<oslogin_common::model::PosixAccount>,

    /// A map from SSH public key fingerprint to the associated key object.
    pub ssh_public_keys:
        std::collections::HashMap<std::string::String, oslogin_common::model::SshPublicKey>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LoginProfile {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::LoginProfile::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [posix_accounts][crate::model::LoginProfile::posix_accounts].
    pub fn set_posix_accounts<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<oslogin_common::model::PosixAccount>,
    {
        use std::iter::Iterator;
        self.posix_accounts = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [ssh_public_keys][crate::model::LoginProfile::ssh_public_keys].
    pub fn set_ssh_public_keys<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<oslogin_common::model::SshPublicKey>,
    {
        use std::iter::Iterator;
        self.ssh_public_keys = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }
}

impl wkt::message::Message for LoginProfile {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.oslogin.v1.LoginProfile"
    }
}

/// A request message for creating an SSH public key.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateSshPublicKeyRequest {
    /// Required. The unique ID for the user in format `users/{user}`.
    pub parent: std::string::String,

    /// Required. The SSH public key and expiration time.
    pub ssh_public_key: std::option::Option<oslogin_common::model::SshPublicKey>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CreateSshPublicKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::CreateSshPublicKeyRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [ssh_public_key][crate::model::CreateSshPublicKeyRequest::ssh_public_key].
    pub fn set_ssh_public_key<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<oslogin_common::model::SshPublicKey>,
    {
        self.ssh_public_key = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [ssh_public_key][crate::model::CreateSshPublicKeyRequest::ssh_public_key].
    pub fn set_or_clear_ssh_public_key<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<oslogin_common::model::SshPublicKey>,
    {
        self.ssh_public_key = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CreateSshPublicKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.oslogin.v1.CreateSshPublicKeyRequest"
    }
}

/// A request message for deleting a POSIX account entry.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeletePosixAccountRequest {
    /// Required. A reference to the POSIX account to update. POSIX accounts are
    /// identified by the project ID they are associated with. A reference to the
    /// POSIX account is in format `users/{user}/projects/{project}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeletePosixAccountRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeletePosixAccountRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeletePosixAccountRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.oslogin.v1.DeletePosixAccountRequest"
    }
}

/// A request message for deleting an SSH public key.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteSshPublicKeyRequest {
    /// Required. The fingerprint of the public key to update. Public keys are
    /// identified by their SHA-256 fingerprint. The fingerprint of the public key
    /// is in format `users/{user}/sshPublicKeys/{fingerprint}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl DeleteSshPublicKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::DeleteSshPublicKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for DeleteSshPublicKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.oslogin.v1.DeleteSshPublicKeyRequest"
    }
}

/// A request message for retrieving the login profile information for a user.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetLoginProfileRequest {
    /// Required. The unique ID for the user in format `users/{user}`.
    pub name: std::string::String,

    /// The project ID of the Google Cloud Platform project.
    pub project_id: std::string::String,

    /// A system ID for filtering the results of the request.
    pub system_id: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetLoginProfileRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetLoginProfileRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [project_id][crate::model::GetLoginProfileRequest::project_id].
    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.project_id = v.into();
        self
    }

    /// Sets the value of [system_id][crate::model::GetLoginProfileRequest::system_id].
    pub fn set_system_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.system_id = v.into();
        self
    }
}

impl wkt::message::Message for GetLoginProfileRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.oslogin.v1.GetLoginProfileRequest"
    }
}

/// A request message for retrieving an SSH public key.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetSshPublicKeyRequest {
    /// Required. The fingerprint of the public key to retrieve. Public keys are
    /// identified by their SHA-256 fingerprint. The fingerprint of the public key
    /// is in format `users/{user}/sshPublicKeys/{fingerprint}`.
    pub name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl GetSshPublicKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::GetSshPublicKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }
}

impl wkt::message::Message for GetSshPublicKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.oslogin.v1.GetSshPublicKeyRequest"
    }
}

/// A request message for importing an SSH public key.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportSshPublicKeyRequest {
    /// Required. The unique ID for the user in format `users/{user}`.
    pub parent: std::string::String,

    /// Optional. The SSH public key and expiration time.
    pub ssh_public_key: std::option::Option<oslogin_common::model::SshPublicKey>,

    /// The project ID of the Google Cloud Platform project.
    pub project_id: std::string::String,

    /// Optional. The regions to which to assert that the key was written.
    /// If unspecified, defaults to all regions.
    /// Regions are listed at <https://cloud.google.com/about/locations#region>.
    pub regions: std::vec::Vec<std::string::String>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ImportSshPublicKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [parent][crate::model::ImportSshPublicKeyRequest::parent].
    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.parent = v.into();
        self
    }

    /// Sets the value of [ssh_public_key][crate::model::ImportSshPublicKeyRequest::ssh_public_key].
    pub fn set_ssh_public_key<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<oslogin_common::model::SshPublicKey>,
    {
        self.ssh_public_key = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [ssh_public_key][crate::model::ImportSshPublicKeyRequest::ssh_public_key].
    pub fn set_or_clear_ssh_public_key<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<oslogin_common::model::SshPublicKey>,
    {
        self.ssh_public_key = v.map(|x| x.into());
        self
    }

    /// Sets the value of [project_id][crate::model::ImportSshPublicKeyRequest::project_id].
    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.project_id = v.into();
        self
    }

    /// Sets the value of [regions][crate::model::ImportSshPublicKeyRequest::regions].
    pub fn set_regions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.regions = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for ImportSshPublicKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.oslogin.v1.ImportSshPublicKeyRequest"
    }
}

/// A response message for importing an SSH public key.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ImportSshPublicKeyResponse {
    /// The login profile information for the user.
    pub login_profile: std::option::Option<crate::model::LoginProfile>,

    /// Detailed information about import results.
    pub details: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ImportSshPublicKeyResponse {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [login_profile][crate::model::ImportSshPublicKeyResponse::login_profile].
    pub fn set_login_profile<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::LoginProfile>,
    {
        self.login_profile = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [login_profile][crate::model::ImportSshPublicKeyResponse::login_profile].
    pub fn set_or_clear_login_profile<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::LoginProfile>,
    {
        self.login_profile = v.map(|x| x.into());
        self
    }

    /// Sets the value of [details][crate::model::ImportSshPublicKeyResponse::details].
    pub fn set_details<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.details = v.into();
        self
    }
}

impl wkt::message::Message for ImportSshPublicKeyResponse {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.oslogin.v1.ImportSshPublicKeyResponse"
    }
}

/// A request message for updating an SSH public key.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateSshPublicKeyRequest {
    /// Required. The fingerprint of the public key to update. Public keys are
    /// identified by their SHA-256 fingerprint. The fingerprint of the public key
    /// is in format `users/{user}/sshPublicKeys/{fingerprint}`.
    pub name: std::string::String,

    /// Required. The SSH public key and expiration time.
    pub ssh_public_key: std::option::Option<oslogin_common::model::SshPublicKey>,

    /// Mask to control which fields get updated. Updates all if not present.
    pub update_mask: std::option::Option<wkt::FieldMask>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UpdateSshPublicKeyRequest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::UpdateSshPublicKeyRequest::name].
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [ssh_public_key][crate::model::UpdateSshPublicKeyRequest::ssh_public_key].
    pub fn set_ssh_public_key<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<oslogin_common::model::SshPublicKey>,
    {
        self.ssh_public_key = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [ssh_public_key][crate::model::UpdateSshPublicKeyRequest::ssh_public_key].
    pub fn set_or_clear_ssh_public_key<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<oslogin_common::model::SshPublicKey>,
    {
        self.ssh_public_key = v.map(|x| x.into());
        self
    }

    /// Sets the value of [update_mask][crate::model::UpdateSshPublicKeyRequest::update_mask].
    pub fn set_update_mask<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [update_mask][crate::model::UpdateSshPublicKeyRequest::update_mask].
    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::FieldMask>,
    {
        self.update_mask = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for UpdateSshPublicKeyRequest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.oslogin.v1.UpdateSshPublicKeyRequest"
    }
}
